**** Further robustness checks *****
cd "$path/Figures and Tables"

******* Table C.4: Replication of the main results (Table 1 and 2) excluding EU member states **********

//Throwing out the EU-states
gen eu=1 if countryname=="Austria" | countryname=="Belgium" | countryname=="Germany" | countryname=="Belgium" | countryname=="Estonia" | countryname=="Spain" | countryname=="Finland" | countryname=="France" | countryname=="United Kingdom of Great Britain and Northern Ireland" | countryname=="Greece" | countryname=="Croatia" | countryname=="Hungary" | countryname=="Ireland" | countryname=="Italy" | countryname=="Netherlands" | countryname=="Poland" | countryname=="Portugal" | countryname=="Romania" | countryname=="Slovakia" | countryname=="Slovenia" | countryname=="Sweden" | countryname=="Lithuania" | countryname=="Latvia" | countryname=="Cyprus" | countryname=="Malta" | countryname=="Bulgaria" | countryname=="Czech Republic" 

replace eu=0 if eu==.

//Average effects
local control "c.GDP_ppp_2015_log##c.v2x_mpi_2015##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"

dsregress Dupont_ambition_low index_2 if eu==0, controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo a

dsregress Dupont_ambition_low indexreg if eu==0, controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo b

dsregress Dupont_ambition_low f1 if eu==0, controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo c

//interaction effects
local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"
dsregress Dupont_ambition_low index_2  v2x_mpi_2015 transamb if eu==0, /// 
controls(`control') selection(cv) rseed(46503448) vce(robust) 
eststo d

local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"
dsregress Dupont_ambition_low indexreg v2x_mpi_2015 transamb1 if eu==0, /// 
controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo e

local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"
dsregress Dupont_ambition_low f1 v2x_mpi_2015 transamb2 if eu==0, vce(robust) /// 
controls(`control') selection(cv) rseed(46503448)
eststo f



esttab a d b e c f  using TableC4.tex, noconstant se  label star( * 0.10 ** 0.05 *** 0.010) ///
title("Replication of the main results (Table 1 and 2) excluding EU member states") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace


****** Replication of the main results (Tables 1 and 2) using alternative definitions of conditionality **********
/* 
Making two new variables that merge information about conditionality of finance 
and technology with information about actual financial and technological needs, 
respectively.
*/

//conditionality of mitigation finance
gen conditionality_fin_new=0 if (conditionality_of_mitigation_fin==0 & costs_of_ccm_class==0) | (conditionality_of_mitigation_fin==0 & costs_of_ccm_class==1) // Equal to zero if conditionality is not mentioned, irrespective of whether costs of ccm are mentioned or not

replace conditionality_fin_new=1 if (conditionality_of_mitigation_fin==1 & costs_of_ccm_class==0) //Conditionality is mentioned in the NDC and costs of ccm are specified.

replace conditionality_fin_new=2 if (conditionality_of_mitigation_fin==2 & costs_of_ccm_class==0) //NDC is partly conditional on contributions, and costs are specified.

replace conditionality_fin_new=3 if (conditionality_of_mitigation_fin==3 & costs_of_ccm_class==0) //Fully conditional on contibution, and costs are specified 

replace conditionality_fin_new=4 if (conditionality_of_mitigation_fin==1 & costs_of_ccm_class==1) //Conditionality is mentioned, but costs of ccm are not specified.

replace conditionality_fin_new=5 if (conditionality_of_mitigation_fin==2 & costs_of_ccm_class==1) //NDC is partly conditional on contributions, but costs are not specified.

replace conditionality_fin_new=6 if (conditionality_of_mitigation_fin==3 & costs_of_ccm_class==1) //Fully conditional on contribution, but costs are not specified. 

//Conditionality of technology transfers
gen conditionality_tech_new=0 if cond_tech==1 & tech_needs==1 // If neither conditionality or technology need are mentioned

replace conditionality_tech_new=1 if cond_tech==1 & tech_needs==3 //Conditionality not mentioned, but specific technology needs are mentioned

replace conditionality_tech_new=2 if cond_tech==1 & tech_needs==2 //Conditionality not mentioned, but technology (not specific) is mentioned

replace conditionality_tech_new=3 if cond_tech==2 & tech_needs==3 //Technology transfers are mentioned, and specific technology need are mentioned

replace conditionality_tech_new=4 if cond_tech==3 & tech_needs==3 //NDC contribution conditional on technology transfer, and specific technology needs are mentioned

replace conditionality_tech_new=5 if cond_tech==2 & tech_needs==2 //Technology transfers are mentioned, and technology (not specific) is mentioned

replace conditionality_tech_new=6 if cond_tech==3 & tech_needs==2 //NDC contribution conditional on technology transfer, and technology (not specific) need are mentioned


replace conditionality_tech_new=7 if cond_tech==2 & tech_needs==1 //Technology transfers are mentioned, but technology needs are not mentioned

replace conditionality_tech_new=8 if cond_tech==3 & tech_needs==1 //NDC contribution conditional on technology transfer, and technology needs are not mentioned.



egen cond_fin_new_z=std(conditionality_fin_new)
egen cond_tech_new_z=std(conditionality_tech_new)

// Making the new indices
*** Equal weights not standardized *****
gen index_2_new= type_target+renewable_energy_class+energy_efficiency_class+transport_class+carbon_capture_and_storage_class+agriculture_class+land_use_and_forestry_class+waste_class+reducing_non_co2_gases_class+land_use_change_class+mitigation_documents_class+planning_of_indc_formulation_cla+stakeholder_consultation_class+planning_of_indc_implementation_+monitoring_and_review_class+conditionality_fin_new+conditionality_tech_new+conditionality_of_capacity_build

******** Weights proportional to the absolute coeficient in explaining: Type target : ikke oppdatert i denne versjonen  ********
//weights are computed in excel. Could also be done automatically in stata: see 2_Further_robustness, Line 241 to 278

reg type_target_z renewable_energy_class_z energy_efficiency_class_z ///
transport_class_z carbon_capture_and_storage_z agriculture_class_z  ///
land_use_and_forestry_class_z ///
mitigation_documents_class_z  reducing_non_co2_gases_class_z ///
land_use_change_class_z   ///
cond_fin_new_z   ///
cond_tech_new_z  conditionality_of_build_z ///
planning_of_ndc_clas_z  stakeholder_consultation_class_z  ///
planning_of_ndc_implementation_z  monitoring_and_review_class_z ///
 waste_class_z if Dupont_ambition_low!=.,r


gen indexreg_new=  renewable_energy_class_z*0.004413576 + ///
energy_efficiency_class_z*0.072430234 + transport_class_z*0.048806011 + ///
carbon_capture_and_storage_z*0.095729076+ ///
agriculture_class_z* 0.013086128 + land_use_and_forestry_class_z*0.029323938 + ///
reducing_non_co2_gases_class_z*0.200781201 + land_use_change_class_z*0.00856326 + ///  
mitigation_documents_class_z* 0.060221251 + /// 
cond_fin_new_z*0.101576865 + cond_tech_new_z*0.110878374 + ///  
conditionality_of_build_z*0.040453747 + planning_of_ndc_clas_z*0.050952954 + /// 
stakeholder_consultation_class_z* 0.090363072+ planning_of_ndc_implementation_z* 0.013803898 + ///  
monitoring_and_review_class_z*0.052423403 + waste_class_z*0.006193013

************** Principal Components
pca type_target_z renewable_energy_class_z energy_efficiency_class_z ///
transport_class_z carbon_capture_and_storage_z agriculture_class_z  ///
land_use_and_forestry_class_z mitigation_documents_class_z ///
reducing_non_co2_gases_class_z land_use_change_class_z    ///
planning_of_ndc_clas_z  stakeholder_consultation_class_z  ///
planning_of_ndc_implementation_z  monitoring_and_review_class_z ///
waste_class_z cond_fin_new_z cond_tech_new_z conditionality_of_build_z 

rotate, varimax

predict f1_new, score


******* TABLE C.5: Replication of the main results (Tables 1 and 2) using alternative definitions of conditionality  ************** 
//running the regressions using double lasso
local control "c.GDP_ppp_2015_log##c.v2x_mpi_2015##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"


dsregress Dupont_ambition_low index_2_new, controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo a1

dsregress Dupont_ambition_low indexreg_new, controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo b1

dsregress Dupont_ambition_low f1_new, controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo c1

// Additive index
gen transamb_new=index_2_new*v2x_mpi_2015

local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"

dsregress Dupont_ambition_low index_2_new v2x_mpi_2015 transamb_new, /// 
controls(`control') selection(cv) rseed(46503448) vce(robust) 
eststo d1

//regression weights
gen transamb1_new=indexreg_new*v2x_mpi_2015

local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"
dsregress Dupont_ambition_low indexreg_new v2x_mpi_2015 transamb1_new, /// 
controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo e1

//PCA_analysis
gen transamb2_new=f1_new*v2x_mpi_2015

local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"
dsregress Dupont_ambition_low f1_new v2x_mpi_2015 transamb2_new, vce(robust) /// 
controls(`control') selection(cv) rseed(46503448)
eststo f1 

esttab  a1 d1 b1 e1 c1 f1 using TableC5.tex, noconstant se  label star( * 0.10 ** 0.05 *** 0.010) ///
title("Replication of the main results (Tables 1 and 2) using alternative definitions of conditionality") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace





******* Displaying the full models ****

****** Table H.6: Reproduction of Table C.4, displaying all control variables ******
reg Dupont_ambition_low index_2  GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.v2x_mpi_2015#c.vulnerability_2015#c.coal_rents_2015#c.natural_gas_rents_2015 c.vulnerability_2015#c.natural_gas_rents_2015 natural_gas_rents_2015 vulnerability_2015 if eu==0, r
estimates store p15

reg Dupont_ambition_low indexreg GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015 vulnerability_2015 if eu==0, r
estimates store p16

reg Dupont_ambition_low f1 GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 vulnerability_2015 if eu==0, r
estimates store p17  

reg Dupont_ambition_low index_2 v2x_mpi_2015 transamb GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.vulnerability_2015#c.coal_rents_2015#c.natural_gas_rents_2015 natural_gas_rents_2015 vulnerability_2015 if eu==0, r
estimates store p12

reg Dupont_ambition_low indexreg v2x_mpi_2015 transamb1 GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.coal_rents_2015#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.GDP_ppp_2015_log#c.vulnerability_2015#c.coal_rents_2015 c.vulnerability_2015#c.coal_rents_2015#c.oil_rents_2015#c.natural_gas_rents_2015 natural_gas_rents_2015 vulnerability_2015 if eu==0, r
estimates store p13

reg Dupont_ambition_low f1 v2x_mpi_2015 transamb2 GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.vulnerability_2015#c.coal_rents_2015#c.oil_rents_2015 vulnerability_2015 if eu==0, r
estimates store p14

esttab  p12 p15 p13 p16 p14 p17 using TableH6.tex, noconstant se r2 label star( * 0.10 ** 0.05 *** 0.010) ///
title("Reproduction of Table C.4, displaying all control variables") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace


****** Table H.7: Reproduction of Table C.5, displaying all control variables ******

reg Dupont_ambition_low index_2_new GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015#c.oil_rents_2015#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.v2x_mpi_2015#c.vulnerability_2015#c.coal_rents_2015#c.natural_gas_rents_2015 c.vulnerability_2015#c.natural_gas_rents_2015 natural_gas_rents_2015 vulnerability_2015,r
estimates store o1

reg Dupont_ambition_low indexreg_new GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015#c.oil_rents_2015#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 vulnerability_2015,r
estimates store o2

reg Dupont_ambition_low f1_new GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015 c.GDP_ppp_2015_log#c.v2x_mpi_2015#c.oil_rents_2015#c.natural_gas_rents_2015 vulnerability_2015,r
estimates store o3

reg Dupont_ambition_low index_2_new v2x_mpi_2015 transamb_new  GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.oil_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.vulnerability_2015#c.coal_rents_2015#c.natural_gas_rents_2015 natural_gas_rents_2015 vulnerability_2015,r
estimates store o4

reg Dupont_ambition_low indexreg_new v2x_mpi_2015 transamb1_new GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.oil_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.vulnerability_2015#c.coal_rents_2015#c.oil_rents_2015#c.natural_gas_rents_2015 natural_gas_rents_2015 vulnerability_2015,r
estimates store o5

reg Dupont_ambition_low f1_new v2x_mpi_2015 transamb2_new GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.oil_rents_2015 vulnerability_2015,r
estimates store o6

esttab  o4 o1 o5 o2 o6 o3 using TableH7.tex, noconstant se r2 label star( * 0.10 ** 0.05 *** 0.010) ///
title("Reproduction of Table C.5, displaying all control variables") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace




******* Using an ordinal logit model to produce the regression weights *******
ologit type_target costs_of_ccm_class_z renewable_energy_class_z energy_efficiency_class_z ///
transport_class_z carbon_capture_and_storage_z agriculture_class_z  ///
land_use_and_forestry_class_z ///
mitigation_documents_class_z  reducing_non_co2_gases_class_z  ///
land_use_change_class_z   ///
conditionality_of_fin_z  technology_needs_class_z  ///
conditionality_of_tra_z  conditionality_of_build_z ///
planning_of_ndc_clas_z  stakeholder_consultation_class_z  ///
planning_of_ndc_implementation_z  monitoring_and_review_class_z ///
 waste_class_z if Dupont_ambition_low!=.,r

mat list e(b)

* Example of creating an index
local i=1
foreach var in costs_of_ccm_class_z renewable_energy_class_z energy_efficiency_class_z ///
transport_class_z carbon_capture_and_storage_z agriculture_class_z  ///
land_use_and_forestry_class_z ///
mitigation_documents_class_z  reducing_non_co2_gases_class_z  ///
land_use_change_class_z   ///
conditionality_of_fin_z  technology_needs_class_z  ///
conditionality_of_tra_z  conditionality_of_build_z ///
planning_of_ndc_clas_z  stakeholder_consultation_class_z  ///
planning_of_ndc_implementation_z  monitoring_and_review_class_z ///
 waste_class_z {
 	
	gen w_un`i' = abs(_b[`var'])
	local ++i
 }

* Calculate total sum of weights
egen total_weight = rowtotal(w_un*)

* Normalize weights
foreach var of varlist w_un* {
	gen norm_`var' = `var'/total_weight
}

* Example of combining weights
gen logit_index = costs_of_ccm_class_z*norm_w_un1 + renewable_energy_class_z*norm_w_un2 + ///
energy_efficiency_class_z*norm_w_un3 + transport_class_z*norm_w_un4 + ///
carbon_capture_and_storage_z*norm_w_un5 + agriculture_class_z*norm_w_un6 + ///
land_use_and_forestry_class_z*norm_w_un7 + ///
mitigation_documents_class_z*norm_w_un8 +  reducing_non_co2_gases_class_z*norm_w_un9 +  ///
land_use_change_class_z*norm_w_un10 +   ///
conditionality_of_fin_z*norm_w_un11 +  technology_needs_class_z*norm_w_un12 +  ///
conditionality_of_tra_z*norm_w_un13 +  conditionality_of_build_z*norm_w_un14 + ///
planning_of_ndc_clas_z*norm_w_un15 +  stakeholder_consultation_class_z*norm_w_un16 +  ///
planning_of_ndc_implementation_z*norm_w_un17 +  monitoring_and_review_class_z*norm_w_un18 + ///
 waste_class_z*norm_w_un19


gen transamb_logit=logit_index*v2x_mpi_2015

local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"
dsregress Dupont_ambition_low logit_index v2x_mpi_2015 transamb_logit, /// 
controls(`control') selection(cv) rseed(46503448) vce(robust)
eststo l1
di e(controls_sel)


*** Robustness tests using the unrotated factor loadings **** 
//d1 is based on the unrotated components, see NDC_coding_and_analysis 
gen transamb_d1=d1*v2x_mpi_2015

local control "c.GDP_ppp_2015_log##c.vulnerability_2015##c.coal_rents_2015##c.oil_rents_2015##c.natural_gas_rents_2015"
dsregress Dupont_ambition_low d1 v2x_mpi_2015 transamb_d1, /// 
controls(`control') selection(cv) rseed(46503448) vce(robust)
di e(controls_sel)
estimates store k1

***** Table C.3: Interaction effect between commitment ambiguity and form of governance with logit weights (instead of OLS) and PCA with unrotated first component ****
esttab l1 k1 using TableC3.tex, noconstant se  label star( * 0.10 ** 0.05 *** 0.010) ///
title("Interaction effect between commitment ambiguity and form of governance with logit weights (instead of OLS) and PCA with unrotated first component") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace

**** Table H.5: Reproduction of Table C.3, model 2  ****
reg Dupont_ambition_low d1 v2x_mpi_2015 transamb_d1 GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.oil_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.GDP_ppp_2015_log#c.vulnerability_2015#c.coal_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015#c.coal_rents_2015#c.oil_rents_2015#c.natural_gas_rents_2015 c.vulnerability_2015#c.coal_rents_2015#c.natural_gas_rents_2015 c.vulnerability_2015#c.coal_rents_2015#c.oil_rents_2015 c.vulnerability_2015#c.natural_gas_rents_2015 c.vulnerability_2015#c.oil_rents_2015 vulnerability_2015, r
estimates store k2

esttab  k2 using TableH5.tex, noconstant se  label star( * 0.10 ** 0.05 *** 0.010) ///
title("Reproduction of Table C.3, model 2") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace


***** Table H.4: Reproduction of Table C.3, model 1  ************
reg Dupont_ambition_low logit_index v2x_mpi_2015 transamb_logit GDP_ppp_2015_log c.GDP_ppp_2015_log#c.coal_rents_2015 c.GDP_ppp_2015_log#c.coal_rents_2015#c.natural_gas_rents_2015 c.GDP_ppp_2015_log#c.coal_rents_2015#c.oil_rents_2015 c.GDP_ppp_2015_log#c.oil_rents_2015 c.GDP_ppp_2015_log#c.vulnerability_2015 c.GDP_ppp_2015_log#c.vulnerability_2015#c.coal_rents_2015#c.oil_rents_2015#c.natural_gas_rents_2015 c.vulnerability_2015#c.coal_rents_2015 c.vulnerability_2015#c.natural_gas_rents_2015 c.vulnerability_2015#c.oil_rents_2015#c.natural_gas_rents_2015 natural_gas_rents_2015 vulnerability_2015, r
estimates store l2

esttab  l2 using TableH4.tex, noconstant se  label star( * 0.10 ** 0.05 *** 0.010) ///
title(": Reproduction of Table C.3, model 1") ///
 nodepvars nomtitles  ///
gap eqlabels(none) collabels(,lhs(Dep Var: NDC Ambition)) replace

clear all

